package com.chrray.position.enums.app;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 性别:1-男,2-女,3-不限
 */
public enum FdGenderEnum implements BaseEnum{
    MALE(1, "男"),
    FEMALE(2, "女"),
    BOTH(3, "不限"),
    ;

    @JsonValue
    @EnumValue
    private final Integer value;
    private final String info;

    FdGenderEnum(Integer value, String info) {
        this.info = info;
        this.value = value;
    }

    @JsonCreator
    public static FdGenderEnum getByValue(Integer value) {
        for (FdGenderEnum en : FdGenderEnum.values()) {
            if (en.getValue().equals(value)) {
                return en;
            }
        }
        return null;
    }
    @JsonCreator
    public static FdGenderEnum getByInfo(String info) {
        for (FdGenderEnum en : FdGenderEnum.values()) {
            if (en.getInfo().equals(info)) {
                return en;
            }
        }
        return BOTH;
    }


    public Integer getValue() {
        return value;
    }

    public String getInfo() {
        return info;
    }
}
